use std::fs;
use std::fs::*;
use std::io::{Write, BufReader, BufRead, Error};

fn main() -> Result<(), Error> {
  let path  = "lines.txt";

  let mut output = File::create(path)?;
  write!(output, "Rust\n💖\nFun")?;

  let input = File::open(path)?;
  let buffered = BufReader::new(input);

  for line in buffered.lines() {
    println!("{}",line?);
  }

  let metadata = fs::metadata("lines.txt")?;
  let file_type = metadata.file_type();
  println!("{:?}", file_type);
  println!("{}", metadata.len());

  Ok(())
}
